package com.weaver.openapi.service;

import com.weaver.openapi.pojo.workreport.params.*;
import com.weaver.openapi.pojo.workreport.res.*;
import com.weaver.openapi.util.*;
import java.util.*;
import cn.hutool.http.*;
import com.alibaba.fastjson.*;
import com.weaver.openapi.pojo.*;

public class ReportService
{
    public static WorkReportResultVo createReportV2(final WorkReportVo workReportVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/x-www-form-urlencoded");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", workReportVo.getAccessToken());
        paramMap.put("userid", workReportVo.getUserid());
        paramMap.put("year", workReportVo.getYear());
        paramMap.put("serialNumber", workReportVo.getSerialNumber());
        paramMap.put("type", workReportVo.getType());
        paramMap.put("content", workReportVo.getContent());
        paramMap.put("summary", workReportVo.getSummary());
        paramMap.put("plan", workReportVo.getPlan());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/workreport/v2/createWorkreport").form((Map)paramMap).headerMap((Map)headers, true)).execute().body();
        return (WorkReportResultVo)JSONObject.parseObject(resJson, (Class)WorkReportResultVo.class);
    }
    
    public static MessageResult updateReportV2(final WorkReportVo workReportVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/x-www-form-urlencoded");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", workReportVo.getAccessToken());
        paramMap.put("userid", workReportVo.getUserid());
        paramMap.put("workreportId", workReportVo.getWorkreportId());
        paramMap.put("paramName", workReportVo.getParamName());
        paramMap.put("paramVal", workReportVo.getParamVal());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/workreport/v2/updateWorkreport").form((Map)paramMap).headerMap((Map)headers, true)).execute().body();
        return (MessageResult)JSONObject.parseObject(resJson, (Class)MessageResult.class);
    }
    
    public static WorkReportResultVo queryReportV2(final WorkReportVo workReportVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/x-www-form-urlencoded");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", workReportVo.getAccessToken());
        paramMap.put("userIds", workReportVo.getUserIds());
        paramMap.put("startDate", workReportVo.getStartDate());
        paramMap.put("endDate", workReportVo.getEndDate());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/workreport/v2/queryWorkreport").form((Map)paramMap).headerMap((Map)headers, true)).execute().body();
        return (WorkReportResultVo)JSONObject.parseObject(resJson, (Class)WorkReportResultVo.class);
    }
    
    public static WorkReportResultVo queryReportStaV2(final WorkReportVo workReportVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/x-www-form-urlencoded");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", workReportVo.getAccessToken());
        paramMap.put("userIds", workReportVo.getUserIds());
        paramMap.put("year", workReportVo.getYear());
        paramMap.put("type", workReportVo.getType());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/workreport/v2/queryWorkreportSta").form((Map)paramMap).headerMap((Map)headers, true)).execute().body();
        return (WorkReportResultVo)JSONObject.parseObject(resJson, (Class)WorkReportResultVo.class);
    }
}
